package com.attendance.mapper;

import com.attendance.Utils.SQLProvider;
import com.attendance.model.Biz.BizRecord;
import com.attendance.model.Form.RecordForm;
import com.attendance.model.Record;
import com.baomidou.mybatisplus.mapper.AutoMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

import java.sql.Date;
import java.util.List;

/**
 *
 * Record 表数据库控制层接口
 *
 */
@Mapper
public interface RecordMapper extends AutoMapper<Record> {

    @Select("select * from record r where r.uid = #{uid} and r.time between #{startDate} and #{endDate}")
    public  List<Record> getByUidAndDate(@Param("uid") int uid, @Param("startDate") Date startDate, @Param("endDate") Date endDate);

    @SelectProvider(type = SQLProvider.class, method = "queryBizRecord")
    public List<BizRecord> getAll(RecordForm recordForm);
}